/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-08-12 17:10:45
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-09-20 15:38:38
 * @FilePath: \project\pyy\src\http\modules\file.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios from "@/utils/axios.js";
import { BASEURL } from "@/http/apiUrl";

import { UPLOAD } from "../apiUrl";
export default {
  // 上传文件
  upload(data) {
    return axios({
      url: UPLOAD,
      method: "post",
      data,
      contentType: false,
      processData: false,
      cache: false,
    });
  },

  /**
   * 下载
   * @param {string} id: 文件id
   * @return {string} 文件资源地址
   */
  downloadService(id) {
    return `${BASEURL}/webjars/file/downloadService/${id}?access_token=${localStorage.frameToken}`;
  },
};
